package com.yanqu.road.server.cmd.union.cross.huaben;

import com.yanqu.road.pb.union.cross.UnionHuaBenProto;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.command.Command;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.player.GamePlayerMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;
import io.netty.channel.ChannelHandlerContext;

@Cmd(code = Protocol.S_CROSS_UNION_HUA_BEN_GUAN_PU_RECORD_SYNC_FROM_CROSS, desc = "关扑奖励公告(同步)")
public class UnionHuaBenGuanPuHistoryRecordSyncCmdFromCross implements Command {

    @Override
    public void execute(ChannelHandlerContext ctx, YanQuMessage packet) throws Exception {

        UnionHuaBenProto.UnionHuaBenGuanPuHistoryRecordSyncMsg syncMsg = UnionHuaBenProto.UnionHuaBenGuanPuHistoryRecordSyncMsg.parseFrom(packet.getBytes());

        for (GamePlayer player : GamePlayerMgr.getCopyPlayerList()) {
            player.sendPacket(Protocol.U_CROSS_UNION_HUA_BEN_GUAN_PU_RECORD_SYNC, UnionHuaBenProto.UnionHuaBenGuanPuHistoryRecordSyncMsg.newBuilder().addAllRecord(syncMsg.getRecordList()));
        }

    }
}
